home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / ATOOLBAR.ZIP / ESTOOLS0.H < prev    next >
C/C++ Source or Header  |  1993-04-06  |  6KB  |  170 lines

  1. /*
  2.     ESTOOLS0.H -- limited header file for use with ESTOOLS.DLL
  3.     Copyright ⌐ Eugene Sokolov 1992-1993, (516)632-7892,
  4.     esokolov@sbchm1.chem.sunysb.edu
  5.  
  6.     You can freely copy, change or redistribute this file as long
  7.     as this notice remains intact.
  8. */
  9. #ifndef __WINDOWS_H
  10. #define STRICT
  11. #include <windows.h>
  12. #endif /* __WINDOWS_H */
  13.  
  14. #ifndef __ESTOOLS_H
  15. #define __ESTOOLS_H
  16.  
  17. /* Tool Bar styles */
  18.  
  19. #define TB_RESOURCE_VERSION 0xE100 // Resource script version, new to v.1.01 !!!
  20.  
  21. #define TBS_CHILD    0x0    // Translated into WS_CHILD -- default;
  22. #define TBS_POPUP    0x1    // Translated into WS_POPUP;
  23. #define TBS_MOVABLE    0x0    // Has caption -- default;
  24. #define TBS_FIXED    0x2    // No caption  -- ignored if TBS_POPUP set;
  25. #define TBS_NOBORDER    0x0    // No border around controls -- default;
  26. #define TBS_BORDER    0x4    // Has a border around controls
  27.                 // if it is clear, than value at TBP_BORDER
  28.                 // offset is ignored;
  29. #define TBS_VISIBLE    0x8    // Translated into WS_VISIBLE;
  30.  
  31.  
  32. /* Tool Bar button styles */
  33. #define TBB_STANDARD    0x0    // Standard Windows-like button -- default;
  34. #define TBB_AUTO2STATE    0x1    // Button remains depressed untill another button
  35.                 // in the same tool bar is pressed;
  36. #define TBB_2STATE    0x2    // Button remains depressed until it state is changed
  37.                 // by sending it a message TBM_CHANGEBTNSTATE -- you need to
  38.                 // register to know how it works or try to figure out yourself;
  39. #define TBB_STATIC    (TBB_AUTO2STATE | TBB_2STATE)
  40.                 //Combination of the two above
  41. #define TBB_DISABLED    0x4    // Button disabled (shadowed)
  42. #define TBB_PRESSED    0x8    // Button initially pressed
  43.  
  44. /* Base for messages */
  45. #define UNDEFINED   WM_USER+???      //it is defined in a real estools.h
  46. // Do not try to use any of these definitions in your program, they
  47. //will produce an error
  48.  
  49. /* Notification messges */
  50.  
  51. #define TBN_CHANGED UNDEFINED+16
  52.                     //
  53.                     //
  54.                     //
  55.                     //
  56.  
  57. /* Tool Bar messages -- need to register to use them or try to find out */
  58. #define TBM_BASE       UNDEFINED
  59. #define TBM_SETBTNSTATE    (TBM_BASE)        //
  60. #define TBM_GETBTNSTATE    (TBM_BASE+1)      //
  61. #define TBM_SETBTNSTYLE    (TBM_BASE+2)        //        The
  62. #define TBM_GETBTNSTYLE    (TBM_BASE+3)        //   explanation for
  63. #define TBM_SETTBSTYLE       (TBM_BASE+4)        //   these messages
  64.                         //   is placed here
  65.                         //    in the real
  66.                         //     estools.h.
  67.                         //
  68.                         //
  69.                         //
  70.                         //
  71.                         //
  72. #define TBM_GETTBSTYLE       (TBM_BASE+5)        //
  73.                         //
  74.                         //
  75. #ifndef RC_INVOKED
  76. /* Structures describing the header of TB resource */
  77. typedef struct tagToolBarControl
  78. {
  79.    UINT tbcBmp;           //Bitmap resource ID
  80.    UINT tbcMsg;           //Button ID
  81.    UINT    tbcStl;           //Button style
  82. }TBCONTROLSTRUCT;
  83. typedef TBCONTROLSTRUCT FAR* LPTBCONTROLSTRUCT;
  84.  
  85. typedef struct tagTBResourceHeader
  86. {
  87.    UINT nVersion;      // ATTENTION !!! New in this version
  88.               // Resource version number. Added for future
  89.               // compatibility. Has to be set to 0xE100
  90.               // (TB_RESOURCE_VERSION)
  91.    UINT nWndName;         // String ID -- identifies TB's name
  92.    WORD wStyle;           // TB style
  93.    int  nXSize;           // Button width
  94.    int  nYSize;           // Button height
  95.    int  nBorder;          // Border size
  96.    int  nRowLen;          // Number of button per horozontal row.
  97.    int  nCtrl;            // Total number of buttons
  98.    TBCONTROLSTRUCT tbcsCtrl[1];  //Individual buttons.
  99. }TBRESOURCEHEADER;
  100. typedef TBRESOURCEHEADER FAR* LPTBRESOURCEHEADER;
  101.  
  102. /* Functions exported from estools.dll */
  103.  
  104. /*
  105.    UINT  CALLBACK ESToolBarVers    ( VOID );
  106.    Retrieves a version number of DLL.
  107.    DLL version.
  108.  
  109.    Parameters:
  110.       NONE.
  111.    Returns:
  112.       DLL version number, in hexadecimal. Current version is 1.01,
  113.       this function returns 0x101. For example for the version
  114.       3.21 it will return 0x321.
  115. */
  116. UINT  CALLBACK    ESToolBarVers    ( VOID );
  117.  
  118. /*
  119.    HWND CALLBACK CreateToolBar( HINSTANCE hInst, LPSTR lpszTemplate,
  120.       HWND hwndParent, POINT pntPosition );
  121.    Creates a tool bar control.
  122.  
  123.    Parameters:
  124.       hInst:        Instance handle (must be an instance of application,
  125.             NOT library);
  126.       lpszTemplate:    Pointer to the null terminated name of the TB template.
  127.       hwndParent:    Parent window of the TB control.
  128.       pntPosition:      Initial position of the TB control. Pay attention,
  129.             is is a POINT struct itself, not a pointer, do not
  130.             try to supply NULL.
  131.    Returns:
  132.       On sucsess returns a window handle of the TB control, NULL otherwise.
  133. */
  134. HWND CALLBACK    CreateToolBar    ( HINSTANCE, LPSTR, HWND, POINT );
  135.  
  136. /*
  137.    BOOL CALLBACK DeleteToolBar( HWND hwnd );
  138.    Destroys the tool bar. This function is called when the TB
  139.    window reseives WM_DESTROY message.
  140.  
  141.    Parameters:
  142.       hwnd:        Window handle of the TB control to be destroyed
  143.    Returns:
  144.       On sucsess returns TRUE, FALSE otherwise.
  145. */
  146. BOOL CALLBACK     DeleteToolBar    ( HWND );
  147.  
  148. /*
  149.    int  CALLBACK GetButtonNumber( HWND hwnd, UINT nId );
  150.    Retrieves the button number from it's ID number,
  151.    analogous to GetDlgItem except that the TB buttons
  152.    are not individual windows and consequently do not have
  153.    handles.
  154.  
  155.    Parameters:
  156.       hwnd:    TB window handle;
  157.       nId    Button ID (equal to the wParam of WM_COMMAND from
  158.         the corresponding button, or second parameter (tbsMsg)
  159.         in the TB resource).
  160.    Returns:
  161.       Button number, which can be used to change button's state or style.
  162.       If no button with such ID exists function returns -1. If several
  163.       buttons share the same ID it returns first it encounters.
  164.  
  165. */
  166. int  CALLBACK    GetButtonNumber    ( HWND, UINT );
  167.  
  168. #endif /* RC_INVOKED */
  169.  
  170. #endif /* __ESTOOLS_H */